﻿var map = null;

function GetMap() {

    map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), {
        credentials:
"Ak4aBfGm0YvIMs57b1E13r0J-l0gX0WCcvbSh9Nqi24R5hnD04xMeQKDKn6Mywlr"
    });

    var viewRect = Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(15.5167, -73.0167), new Microsoft.Maps.Location(9.5167, -67.0167));





    var center = new Microsoft.Maps.Location(12.5167, -70.0167);

    // Add a pin to the center of the map
    var pin = new Microsoft.Maps.Pushpin(center, { text: '' });

    // Create the info box for the pushpin
    pinInfobox = new Microsoft.Maps.Infobox(new Microsoft.Maps.Location(12.5167 + 0.5, -70.0167), { title: 'Aruba', visible: true, width: 256, height: 80 });



    // Add a handler for the pushpin click event.
    Microsoft.Maps.Events.addHandler(pin, 'click', displayInfobox);
    map.setView({ bounds: viewRect });
    // Hide the info box when the map is moved.
    //Microsoft.Maps.Events.addHandler(map, 'viewchange', hideInfobox);


    // Add the pushpin and info box to the map
    map.entities.push(pin);
    setTimeout(function () { map.entities.push(pinInfobox) }, 0);


}

function displayInfobox(e) {
    pinInfobox.setOptions({ visible: true });
}


function hideInfobox(e) {
    pinInfobox.setOptions({ visible: false });
}
